package com.examiner.dao;

import com.examiner.bean.test.NewTest;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface NewTestDao extends JpaRepository<NewTest,Integer>, JpaSpecificationExecutor<NewTest> {

    @Query(value = "select * from new_test where new_test_create=?1 and (test_title like %?4% or test_create like %?4%) limit ?2,?3",nativeQuery = true)
    List<NewTest> getNewTestList(String userName, int i, int pageSize, String query);

    @Query(value = "select count(id)from new_test where new_test_create=?1 and (test_title like %?2% or test_create like %?2%)", nativeQuery = true)
    int getNewTestListTotal(String userName, String query);
}
